package com.bright.cwduijie.duijie.repository;

import com.bright.cwduijie.duijie.pojo.po.DuijieBatch;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Optional;

public interface DuijieBatchRepository extends JpaRepository<DuijieBatch, Integer>, JpaSpecificationExecutor<DuijieBatch> {
    List<DuijieBatch> getAllBySjjhbz(int sjjhbz);

    @Query("from DuijieBatch where batchId=:batchId order by ztDataKey, createDate, batchOrder")
    Optional<DuijieBatch> getByBatchId(@Param("batchId") String nextBatchId);

}